<?php
include("./common.php");

$page = $_GET['page'];
$pagesize = $_GET['pagesize'];

!$page && $page = 1;
!$pagesize && $pagesize = 20;

$limit = "LIMIT ".($page-1)*$pagesize.",$pagesize";

$query = $db->query("SELECT title,id,posttime FROM ".tname('news')." ORDER BY posttime DESC $limit ");
while($array = $db->fetch_array($query)){
	$rs[] = $array;
}

$amount = $db->get_one("SELECT count(*) as amount FROM ".tname('news'));
$pages = multi($amount['amount'],$pageSize,$page,"news_list.php?");

include template("news_list");
?>